package com.rimi.service.impl;

import com.rimi.bean.Code;
import com.rimi.mapper.CodeMapper;
import com.rimi.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author liHaiYang
 * @version V1.0
 * @Description: (用一句话描述该文件做什么)
 * @date 2021/7/8 9:56
 */
@Service
public class CodeServiceImpl implements CodeService {
    @Autowired
    CodeMapper codeMapper;

    @Override
    public int addCode(Code code1) {
        return codeMapper.addCode(code1);
    }

    @Override
    public boolean findCodeByCodeAndPhoneNumber(String code, String phoneNumber) {
        Date date = new Date();
        Code code1 = codeMapper.findCodeByCodeAndPhoneNumber(code,phoneNumber,date);
        return code1 != null;
    }
}
